<template>
  <div class="UserInfo">
      <label>用户名</label>
      <input type="text" v-model="userName" />
      <label>密码</label>
      <input type="password" v-model="password" />
      <br/>
      <button @click="getUserInfo">登陆</button>
  </div>
</template>

<script>
import {mapMutations} from 'vuex'
export default {
  name: "UserInfo",
  data() {
    return {
      userName: "",
      password: ""
    };
  },
  methods: {
    putUserInfo() { 
      this.$emit("getUserInfo", {
        userName: this.userName,
        password: this.password
      });
    },
    mutationName() {
      return this.$store.commit("putName");
    },
    
    ...mapMutations(['getInfo']),
    getUserInfo() {
      var userInfo = {
          user:this.userName,
          password:this.password
      }
      this.getInfo(userInfo);
    },
  }
};
</script>
<style>
</style>
